package versionx

// RootMap只用于管理Root, 便于coder进行处理
type RootMap map[string]IRoot

func (m RootMap) Get(key string) (r IRoot, has bool) {
	r, has = m[key]
	if has == false {
		return
	}
	return
}

func (m RootMap) Remove(key string) {
	_, has := m[key]
	if has == false {
		return
	}
	//src.RefRemove()
}

func (m RootMap) Set(r IRoot) {
	//m[r.RefKey()] = r
}

func (m RootMap) DisposeAll() {
	for key, val := range m {
		val.RefDispose()
		delete(m, key)
	}
}

func (m RootMap) DisposeRemoved() {
	for key, val := range m {
		if val.RefIsRemove() == false {
			continue
		}
		val.RefDispose()
		delete(m, key)
	}
}
